<template>
    <div>
        <div>
            <input type="text" placeholder="请输入用户名" v-model="forms.username"><br>
            <input type="text" placeholder="请输入密码" v-model="forms.pwd"><br>
            <button @click="submit(forms)">提交</button>
        </div>
    </div>
</template>

<script>
import axios from 'axios'
    export default {
        data() {
            return {
                forms:{
                    username:'',
                    pwd:''
                }
            }
        },
        methods: {
            submit(val){
                var {username,pwd} = val
                axios.post('http://192.168.4.93:8000/login',{username,pwd}).then(res=>{
                    if(res.data.auth){
                        this.$router.push('/home')
                    }else{
                        alert(res.data.msg)
                    }
                })
            }
        },
    }
</script>

<style scoped>

</style>